package com.digital.herbarium.Util;

import cn.hutool.core.util.StrUtil;
import com.digital.herbarium.Entity.BaseLibrary;
import com.digital.herbarium.Exception.CustomException;

public class BaseLibraryUtil {

    public static void checkBaseLibraryInfo(BaseLibrary baseLibrary){
        if(StrUtil.hasEmpty(baseLibrary.getSpeciesZhName()) || StrUtil.hasBlank(baseLibrary.getSpeciesZhName())){
            throw new CustomException(400,"物种中文名不能为空");
        }
        if(StrUtil.hasEmpty(baseLibrary.getCanonicalName()) || StrUtil.hasBlank(baseLibrary.getCanonicalName())){
            throw new CustomException(400,"物种拉丁名不能为空");
        }
        if(StrUtil.hasEmpty(baseLibrary.getSpeciesClass()) || StrUtil.hasBlank(baseLibrary.getSpeciesClass())){
            throw new CustomException(400,"Class（纲）不能为空");
        }
        if(StrUtil.hasEmpty(baseLibrary.getSpeciesZhName()) || StrUtil.hasBlank(baseLibrary.getSpeciesZhName())){
            throw new CustomException(400,"Order（目）不能为空");
        }
        if(StrUtil.hasEmpty(baseLibrary.getSpeciesZhName()) || StrUtil.hasBlank(baseLibrary.getSpeciesZhName())){
            throw new CustomException(400,"Family（科）不能为空");
        }
        if(StrUtil.hasEmpty(baseLibrary.getSpeciesZhName()) || StrUtil.hasBlank(baseLibrary.getSpeciesZhName())){
            throw new CustomException(400,"科中文名不能为空");
        }
        if(StrUtil.hasEmpty(baseLibrary.getSpeciesZhName()) || StrUtil.hasBlank(baseLibrary.getSpeciesZhName())){
            throw new CustomException(400,"species author不能为空");
        }
    }
}
